% Using Moment-Area to find deformations along members

L = 6;
EI = 1.8e5;
w = 20;
h = 0.05;

x = 0:h:L;
Va = w*L/2;
M = Va.*x-w*x.^2./2;
Ro = -w*(L)^3/(24*EI);
Ri = cumtrapz(M)*h/EI + Ro;
d = cumtrapz(Ri)*h;

subplot(3,1,1); 
    plot(x,M); grid on;
    ylabel('Bending Moment (kNm)');
subplot(3,1,2); 
    plot(x,1e3*Ri); grid on;
    ylabel('Rotation (mrads)');
subplot(3,1,3); 
    plot(x,d*1e3); grid on;
    xlabel ('Distance Along Member (m)'); 
    ylabel('Deflection (mm)');